package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    @Results({
            @Result(property = "id", column = "id", id = true),
            @Result(property = "username", column = "username"),
            @Result(property = "password", column = "password"),
            @Result(property = "orderList" ,column = "id" ,javaType = List.class,
            many = @Many(select = "com.itheima.dao.OrderMapper.findById"))
    })
    @Select("select * from user")
    List<User> findAllUserAndOrder();
}
